<?php

!defined('BASE_PATH')&&die('forbidden');

class core_action{
	
	public function __before(){
		//empty
	}
	
	public function __after(){
		//empty
	}
	
	public function __run(){
		
		$args = core::router()->get_args();
		call_user_func_array(array(&$this,'__before'),$args);
		call_user_func_array(array(&$this,core::router()->get_method()),$args);
		call_user_func_array(array(&$this,'__after'),$args);
		
	}
	
	public function __call($func,$args){
		
		core::exit_404('method is not exist.');
		
	}

	public function _get($key, $default = null) {
		return (isset($_GET[$key]) && trim($_GET[$key])!='') ? trim($_GET[$key]) : $default;
	}

	public function _g($key, $default = null) {
		return $this->_get($key, $default);
	}

	public function _post($key, $default = null) {
		return (isset($_POST[$key]) && trim($_POST[$key])!='') ? trim($_POST[$key]) : $default;
	}

	public function _p($key, $default = null) {
		return $this->_post($key, $default);
	}

}

?>